package bean;

import java.util.Map;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;

import dao.DoctorDAO;
import dao.JPA;
import entity.Doctor;

@Named
@RequestScoped
public class ViewDoctorProfileBean {

	@Inject @JPA
	private DoctorDAO doctorDAO;
	private Doctor doctor = new Doctor();
	
	@PostConstruct
	private void init() {
		FacesContext context = FacesContext.getCurrentInstance();
		Map<String, String> params = context.getExternalContext().getRequestParameterMap();		
		doctor = doctorDAO.getEntityById(Integer.valueOf(params.get("doctorId")));		
	}
	
	public Doctor getDoctor() {
		return doctor;
	}
	
}
